import request from '@/utils/request'

export function listRoute() {
  return request({
    url: 'system/route/tree',
    method: 'get'
  })
}

export function detailRoute(id) {
  return request({
    url: 'system/route/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export function treeRoute() {
  return request({
    url: 'system/route/tree',
    method: 'get'
  })
}

export function addRoute(data) {
  return request({
    url: 'system/route/add',
    method: 'post',
    params: data
  })
}

export function modifyRoute(data) {
  return request({
    url: 'system/route/modify',
    method: 'post',
    params: data
  })
}

export function deleteRoute(id) {
  return request({
    url: 'system/route/delete',
    method: 'delete',
    params: {
      id
    }
  })
}

export function apiList(id) {
  return request({
    url: 'system/route/api-list',
    method: 'get',
    params: {
      parentId: id
    }
  })
}

export function apiAdd(data) {
  return request({
    url: 'system/route/add-api',
    method: 'post',
    params: data
  })
}

export function buttonAdd(data) {
  return request({
    url: 'system/route/add-button',
    method: 'post',
    params: data
  })
}

export function buttonList(id) {
  return request({
    url: 'system/route/button-list',
    method: 'get',
    params: {
      parentId: id
    }
  })
}

export function buttonModify(data) {
  return request({
    url: 'system/route/modify-button',
    method: 'post',
    params: data
  })
}
